[AKS] az aks bastion: Add new option --kubeconfig-path to allow users to specify an existing kubeconfig file#9509
Conversation
|
| rule | cmd_name | rule_message | suggest_message |
|---|---|---|---|
| aks bastion | cmd aks bastion added parameter kubeconfig_path |
|
Hi @FumingZhang, |
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
|
Queued live test to validate the change, test passed!
|
CodeGen Tools Feedback CollectionThank you for using our CodeGen tool. We value your feedback, and we would like to know how we can improve our product. Please take a few minutes to fill our codegen survey |
|
5796c46 to
4c3fcca
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds a --kubeconfig-path option to the az aks bastion command, enabling users to specify an existing kubeconfig file instead of downloading credentials to a temporary location. When specified, the command modifies the existing kubeconfig to point to the bastion tunnel and warns users that the configuration will stop working once the tunnel is closed.
Changes:
- Added
--kubeconfig-pathparameter to allow specifying an existing kubeconfig file - Enhanced kubeconfig modification logic to support both new and existing kubeconfig files with cluster name matching
- Improved process cleanup for bastion tunnel to properly terminate child processes on both Windows and Unix systems
- Fixed subnet address prefix in test to use Azure Bastion-compliant CIDR range
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| setup.py | Version bumped to 19.0.0b20 for the new feature |
| HISTORY.rst | Added release notes documenting the new --kubeconfig-path option |
| _params.py | Registered the new kubeconfig_path parameter |
| _help.py | Added documentation and examples for the new parameter |
| custom.py | Modified aks_bastion function to handle existing kubeconfig files and improved cleanup logic |
| bastion.py | Enhanced aks_bastion_set_kubeconfig with cluster name matching, improved process termination with new _aks_bastion_kill_process_tree helper |
| test_aks_commands.py | Fixed subnet address prefix from /16 to /26 for Azure Bastion compliance |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
[Release] Update index.json for extension [ aks-preview-19.0.0b20 ] : https://dev.azure.com/msazure/One/_build/results?buildId=149578247&view=results |
This checklist is used to make sure that common guidelines for a pull request are followed.
Related command
az aks bastionWhen you specify a value for the new
--kubeconfig-pathoption:The command will notify the user that "The server URL for cluster 'xxx' in your kubeconfig has been updated to point to the bastion tunnel. Once the bastion tunnel is closed, this cluster configuration will stop working. To restore connectivity, rerun this command to automatically update the server URL and create a new tunnel."

The command will fail if the provided kubeconfig does not have a cluster with a name that exactly matches the one specified in the command.

If you do not specify the new option, the command will behave as before: it will download the kubeconfig to a temporary path, which will be deleted once the command exits.

General Guidelines
azdev style <YOUR_EXT>locally? (pip install azdevrequired)python scripts/ci/test_index.py -qlocally? (pip install wheel==0.30.0required)For new extensions:
About Extension Publish
There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update
src/index.jsonautomatically.You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify
src/index.json.